import { Graph } from "@antv/x6";
import * as FlowGraph from "../../core/create";
import { CustomGraphType } from "../type";
import { BaseNodeConfigPanel } from "../../shared";
import { BODY, PORTS } from "../../default";

// 文本节点
Graph.registerNode("CustomText", {
	inherit: "rect",
	width: 70,
	height: 30,
	attrs: {
		body: {
			...BODY,
			strokeWidth: 0,
			fillOpacity: 0
		},
		label: {
			text: "文本节点",
			fontSize: 16,
			fill: "#000000",
			refX: "50%",
			refY: "50%",
			fontWeight: 400
		}
	},
	data: { type: CustomGraphType.文本 },
	ports: { ...PORTS }
});

FlowGraph.install(CustomGraphType.文本, ({ graph, appendStencil }) => {
	appendStencil([graph.createNode({ shape: "CustomText" })]);
	return { configPanel: BaseNodeConfigPanel };
});
